package com.lw.test.controller;

import com.lw.test.entity.ValidatorVO;
import com.lw.test.entity.group.HasIdGroup;
import javax.validation.groups.Default;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Request Param 方式传参校验
 *
 * @author LiuWang
 */
@RestController
@RequestMapping("/body")
public class RequestBodyValidateController {

  @PostMapping
  public ValidatorVO body(
      @Validated({Default.class, HasIdGroup.class}) @RequestBody ValidatorVO vo) {
    return vo;
  }

}
